#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=m;i++){
            cin>c[i];
    }
    int x=1,k=0,s=1;
    while(x<n){
        x=x*2;
        k++;
    }
    for(int i=1;i<=k;i++){
        string s;
        cin>>s;
    }
    int T;
    cin>>T;
    if(T==1)cout<<17;
    while(T--){
        cout<<T*2+1<<endl;
    }
    return 0;
}
